﻿// Class to start, stop, shutdown the service
// <copyright file="ServiceInstaller.cs" company="EasyCompany">
// EasyCompany
// </copyright>
namespace PstBakup2013Server
{
    using System.ComponentModel;
    using System.Configuration.Install;
    using System.ServiceProcess;

    /// <summary>
    /// Class to install the Windows Service.
    /// </summary>
    [RunInstaller(true)]
    public sealed class ServiceInstaller : Installer
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceInstaller" /> class.
        /// </summary>
        public ServiceInstaller()
        {
            ServiceProcessInstaller processInstaller = new ServiceProcessInstaller();
            System.ServiceProcess.ServiceInstaller serviceInstaller = new System.ServiceProcess.ServiceInstaller();

            processInstaller.Account = ServiceAccount.LocalService;
            processInstaller.Username = null;
            processInstaller.Password = null;

            serviceInstaller.DisplayName = "Pst Backup 2013 Server";
            serviceInstaller.StartType = ServiceStartMode.Automatic;
            serviceInstaller.DelayedAutoStart = true;

            serviceInstaller.ServiceName = "PstBackup2013Server";
            serviceInstaller.Description = "Receive informations from Pst Backup 2013 clients and log it into the database.";
            ////serviceInstaller.ServicesDependedOn = new string[] { "MSSQL$SQLEXPRESS" };

            this.Installers.Add(processInstaller);
            this.Installers.Add(serviceInstaller);
        }
    }
}
